package cn.doitedu.datayi.data_service.utils;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

import java.io.IOException;

public class HbaseConnectionUtil {

    public static Connection conn ;

    public static Connection getConn() throws IOException {

        if(conn == null) {
            Configuration conf = HBaseConfiguration.create();
            conf.set("fs.defaultFS","hdfs://hdp01:8020");
            conf.set("hbase.zookeeper.quorum","hdp01:2181,hdp02:2181,hdp03:2181");
            conn = ConnectionFactory.createConnection(conf);
        }
        return conn;
    }

}
